using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using NUnit.Framework;
using System.Collections.Specialized;

namespace CustomCMS.QA
{
	[TestFixture]
	public class Pages
	{
		[SetUp]
		public void SetPage()
		{
			NameValueCollection vals = new NameValueCollection();

			vals["action"] = "set_page";
			vals["path"] = "*mike*";
			vals["templateId"] = "index.tmpl";
			vals["userId"] = "nimrod";
			vals["title"] = "casino.com+cms+rules";
			vals["content"] = "<root><param name=\"footer\">footer text</param></root>";
			vals["comment"] = "first+revision";
			vals["pageId"] = "index.html";

			XmlDocument doc = Util.ExecuteWebRequest(vals);

			Util.VerifyResult(doc, "Success");

		}
		
		[Test]
		public void GeneratePage()
		{
			NameValueCollection vals = new NameValueCollection();

			vals["action"] = "generate_page";
			vals["path"] = "*mike*";
			vals["pageId"] = "index.html";

			XmlDocument doc = Util.ExecuteWebRequest(vals);

			Util.VerifyResult(doc, "Success");
		}

		[Test]
		public void LockPage()
		{
			NameValueCollection vals = new NameValueCollection();

			vals["action"] = "lock_element";
			vals["path"] = "*mike*";
			vals["type"] = "page";
			vals["elementId"] = "index.html";
			vals["userId"] = "david";

			XmlDocument doc = Util.ExecuteWebRequest(vals);

			Util.VerifyResult(doc, "Success");
		}

		[Test]
		public void UnlockPage()
		{
			NameValueCollection vals = new NameValueCollection();

			vals["action"] = "unlock_element";
			vals["path"] = "*mike*";
			vals["type"] = "page";
			vals["elementId"] = "index.html";
			vals["userId"] = "david";

			XmlDocument doc = Util.ExecuteWebRequest(vals);

			Util.VerifyResult(doc, "Success");
		}

	}
}
